{literal}
<script type="text/javascript">
<!--
function confirmDelete(articleId) {
if (confirm("This will delete this user. Continue?"))
document.location = "admin.php?page=users&action=delete&id=" + articleId;
}
//-->
</script>
{/literal}
{if ($action == "done") || ($action=='')}
{if $numusers > 0}
<h2>List of Users</h2>
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
<tr> 
  <th width="20%" class="smallhead">Action</th>
  <th width="20%" class="smallhead">Username</th>
  <th width="25%" class="smallhead">Patrol</th>
  <th width="30%" class="smallhead">Last Login</th>
  <th width="10%" class="smallhead">Login Count</th>
</tr>

{section name=users loop=$numusers}
<tr>
  <td width="20%"  {if $row[users].status == 1}class="text"{else}class="inactive"{/if}>{if ($row[users].level > $level && $level <= 2) || ($level == 1 && $row[users].level != 0) || ($level == 0)}<a href="admin.php?page=user_edit&amp;action=Edit&amp;id={$row[users].id}"><img src="{$tempdir}admin/images/edit.gif" alt="Edit {$row[users].uname}'s details" title="Edit {$row[users].uname}'s details" border="0" /></a> - {/if}{if (((($row[users].level > $level) && $level <= 3) || ($level == 0) || ($level == 1 && $row[users].level != 0))) && $row[users].troopuser == 1}<a href="admin.php?page=records&id={$row[users].id}&action=edit"><img src="{$tempdir}admin/images/record.png" alt="Edit {$row[users].uname}'s scouting record" title="Edit {$row[users].uname}'s scouting record" border="0" /></a> - {/if}<a href="admin.php?page=users_view&amp;id={$row[users].id}" ><img src="{$tempdir}admin/images/mod.gif" alt="View {$row[users].uname}'s Details" title="View {$row[users].uname}'s Details" border="0"/></a>{if (($row[users].level > $level && $level <= 1) || ($level == 1 && $row[users].level != 0) || ($level == 0)) && ($row[users].uname != $uname)} - 
  <a href="javascript:confirmDelete('{$row[users].id}')"><img src="{$tempdir}admin/images/delete.gif"  border="0" alt="Delete {$row[users].uname}" title="Delete {$row[users].uname}" /></a>{/if}</td>
  <td width="20%"  {if $row[users].status == 1}class="text"{else}class="inactive"{/if}>{if $row[users].uname == $uname}<span class="user">{/if}{$row[users].uname}{if $row[users].uname == $uname}</span>{/if}</td>
  <td width="25%"  {if $row[users].status == 1}class="text"{else}class="inactive"{/if}>{$row[users].team}</td>
  <td width="30%"  {if $row[users].status == 1}class="text"{else}class="inactive"{/if}>{if $row[users].lastlogin > 0}{$row[users].lastlogin+$timeoffset|date_format:"%B %e, %Y %H:%M"}{else}Never logged in{/if}</td>
  <td width="10%"  {if $row[users].status == 1}class="text"{else}class="inactive"{/if}>{$row[users].logincount}</td>
</tr>
{/section}
</table>
{else}
<div align="center">No Users</div>
{/if}
 <div align="center"> 
<form name="form2" method="post" action="{$editFormAction}">
 Show all users where
      <select name="field" class="inputbox">
        <option value="none" selected>No Filter</option>
        <option value="uname">Username</option>
        <option value="team">Group</option>
        <option value="lastlogin">Last Login</option>
        <option value="status">Status</option>
        <option value="logincount">Login Count</option>
    </select>
    is 
    <select name="comp" class="inputbox">
      <option value="=" selected>Equal to</option>
      <option value="&gt;">Greater than</option>
      <option value="&lt;">Less than</option>
      <option value="&gt;=">Greater or equal to</option>
      <option value="&lt;=">Less or equal to</option>
      <option value="!=">Not equal to</option>
      <option value="LIKE">is like (Use % as wildcard)</option>
      <option value="NOT LIKE">is not like (Use % as wildcard)</option>
    </select> 
    <input name="cond" type="text" id="cond" class="inputbox" /> sort 
    <select name="order" class="inputbox">
        <option value="ASC">Ascending</option>
        <option value="DESC">Decending</option>
    </select>    
by
      <select name="sort" class="inputbox">
        <option value="uname">Username</option>
        <option value="team">Group</option>
        <option value="lastlogin">Last Login</option>
        <option value="status">Status</option>
        <option value="logincount">Login Count</option>
    </select>    
    <input type="submit" name="Submit" value="Go" class="button" />
</form></div>
{elseif ($limit=="no")}
<form name="form1" method="post" action="{$editFormAction}">
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
    <tr>
      <th colspan="2" class="bighead">Website Access </th>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Username</div></td>
      <td width="59%" class="text">
        <div align="left">
          <input name="usernames" type="text" size="40" value="{$uinfo.uname}" class="inputbox" />
        </div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Password</div></td>
      <td class="text"><div align="left"><input name="passwords" type="password" size="40" class="inputbox" /></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Administration Panel Access Level</div></td>
	  <td class="text"><div align="left"><select name="access" class="inputbox">
			<option value="0" {if $uinfo.level == 0}selected{/if}>Administrator Access Level</option>
			<option value="1" {if $uinfo.level == 1}selected{/if}>Scouter Access Level</option>
			<option value="2" {if $uinfo.level == 2}selected{/if}>Troop Leader Access Level</option>
			<option value="3" {if $uinfo.level == 3}selected{/if}>Group Leader Access Level</option>
			<option value="4" {if $uinfo.level == 4}selected{/if}>Second Access Level</option>
			<option value="5" {if $uinfo.level == 5}selected{/if}>No Administration Panel Access</option>
      </select></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Group</div></td>
      <td class="text"><div align="left">
	  <select name="team" class="inputbox">
	  	{section name=teams loop=$numteams}
			<option value="{$teamlist[teams]}" {if $uinfo.team == $teamlist[teams]}selected{/if}>{$teamlist[teams]}</option>
		{/section}
      </select></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Status</div></td>
      <td class="text"><div align="left"><select name="status" class="inputbox">
	   <option value="1" {if $uinfo.status == 1}selected{/if}>Active</option>
	   <option value="0" {if $uinfo.status == 0}selected{/if}>Inactive</option>
      </select></div></td>
    </tr>
    <tr>
      <td align="right" class="text"><div align="right">Timezone </div></td>
      <td align="left" class="text"><div align="left">
        <select name="zone" id="zone" class="inputbox">
            {section name=zones loop=$numzones}
                <option value="{$zone[zones].id}" {if ($uinfo.timezone == $zone[zones].id)}selected{/if}>{$zone[zones].offset} Hours</option>
            {/section}
        </select>
      </div></td>
    </tr>
    <tr>
      <th colspan="2" class="bighead"><div align="center">Personal Information</div></th>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">First Name</div></td>
      <td class="text"><div align="left"><input name="firstname" type="text" size="40" value="{$details.firstname}" class="inputbox" /></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Last Name</div></td>
      <td class="text"><div align="left"><input name="lastname" type="text" size="40" value="{$details.lastname}" class="inputbox" /></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Date Of Birth</div></td>
      <td class="text"><div align="left"><input name="dob" type="text" size="40" value="{$details.dob}" class="inputbox" /></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Telephone Number</div></td>
      <td class="text"><div align="left"><input name="tel" type="text" size="40" value="{$details.tel}" class="inputbox" /></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Cellphone Number</div></td>
      <td class="text"><div align="left"><input name="cell" type="text" size="40" value="{$details.cell}" class="inputbox" /></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Address</div></td>
      <td class="text"><div align="left"><textarea name="address" cols="50" rows="5" class="inputbox">{$details.address}</textarea></div></td>
    </tr>
    <tr>
      <td width="41%" class="text"><div align="right">Email Address</div></td>
      <td class="text"><div align="left"><input name="email" type="text" size="60" value="{$details.email}" class="inputbox" /></div></td>
    </tr>
    <tr valign="baseline">
       <td align="right" class="text"><div align="right">Is this user part of the troop?</div></td>
       <td align="left" class="text"><div align="left"><input type="radio" name="troopuser" id="troopuser" value="1" {if $details.troopuser != 0}checked="checked"{/if} />Yes&nbsp;<input type="radio" name="troopuser" id="troopuser" value="0" {if $details.troopuser != 1}checked="checked"{/if} />No</div></td>
     </tr>
    <tr>
      <td align="right" class="text"><div align="right">Award Scheme to use:</div></td>
      <td align="left" class="text"><div align="left">
        <select name="scheme" id="scheme" class="inputbox">
            {if $details.troopuser == 0}<option value="0">Not a troop user</option>{/if}
            {section name=awards loop=$numschemes}
                <option value="{$schemes[awards].id}" {if ($details.scheme == $schemes[awards].id)}selected{/if}>{$schemes[awards].name} Award Scheme</option>
            {/section}
        </select>
      </div></td>
    </tr>
    {if ((($uinfo.level > $userlevel) && $userlevel <= 3) || ($userlevel == 0) || ($userlevel == 1 && $uinfo.level != 0)) && $details.troopuser == 1}<tr>
      <th colspan="2" class="bighead"><input type="button" class="button" value="Edit Scout Record" onclick="window.location='admin.php?page=records&amp;id={$uinfo.id}&amp;action=edit'" /></th>
    </tr>{/if}
    <tr>
      <th colspan="2"  align="center" class="bighead"><input type="submit" name="Submit" value="{$action}" class="button" />
        <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="window.location='admin.php?page=users';" class="button" /></th>
    </tr>
  </table>
</form>
{elseif ($limit == "yes")}
	<form name="form1" method="post" action="{$editFormAction}">
<table width="100%" border="0" cellspacing="1" cellpadding="4" align="center" class="table">
		<tr>
		  <th colspan="2" class="bighead">Website Access </th>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Username</div></td>
		  <td align="left" class="text"><div align="left">{$uinfo.uname}</div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Administration Panel Access Level</div></td>
		  <td align="left" class="text"><div align="left">	
            {if $uinfo.level == 0}Administrator Access Level
			{elseif $uinfo.level == 1}Scouter Access Level
			{elseif $uinfo.level == 2}Troop Leader Access Level
			{elseif $uinfo.level == 3}Group Leader Access Level
			{elseif $uinfo.level == 4}Second Access Level
            {elseif $uinfo.level == 5}No Administration Panel Access{/if}</div></td>
		</tr>
        <tr>
		  <td width="50%" align="right" class="text"><div align="right">Group: </div></td>
		  <td align="left" class="text"><div align="left">{$uinfo.team}</div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Status</div></td>
		  <td align="left" class="text"><div align="left">{if $uinfo.status == 1}Active{else}Inactive{/if}</div></td>
		</tr>
		<tr>
		  <th colspan="2" class="bighead"><div align="center">Personal Information</div></th>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">First Name</div></td>
		  <td align="left" class="text"><div align="left"><input name="firstname" type="text" size="40" value="{$details.firstname}" class="inputbox" /></div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Surname</div></td>
		  <td align="left" class="text"><div align="left"><input name="lastname" type="text" size="40" value="{$details.lastname}" class="inputbox" /></div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Date Of Birth</div></td>
		  <td align="left" class="text"><div align="left"><input name="dob" type="text" size="40" value="{$details.dob}" class="inputbox" /></div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Telephone Number</div></td>
		  <td align="left" class="text"><div align="left"><input name="tel" type="text" size="40" value="{$details.tel}" class="inputbox" /></div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Cellphone Number</div></td>
		  <td align="left" class="text"><div align="left"><input name="cell" type="text" size="40" value="{$details.cell}" class="inputbox" /></div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Address</div></td>
		  <td align="left" class="text"><div align="left"><textarea name="address" cols="50" rows="5" class="inputbox">{$details.address}</textarea></div></td>
		</tr>
		<tr>
		  <td width="50%" align="right" class="text"><div align="right">Email Address</div></td>
		  <td align="left" class="text"><div align="left"><input name="email" type="text" size="60" value="{$details.email}" class="inputbox" /></div></td>
		</tr>
        <tr valign="baseline">
       <td align="right" class="text"><div align="right">Is this user part of the troop?</div></td>
       <td align="left" class="text"><div align="left">{if $details.troopuser != 0}Yes{else}No{/if}</div></td>
     </tr>
     {if $details.troopuser != 0}
    <tr>
      <td align="right" class="text"><div align="right">Award Scheme for user:</div></td>
      <td align="left"  class="text"><div align="left">
            {section name=awards loop=$numschemes}
                {if ($details.scheme == $schemes[awards].id)}{$schemes[awards].name} Award Scheme{/if}
            {/section}
      </div></td>
    </tr>
    {/if}
        {if (($uinfo.level > $userlevel) && $userlevel <= 3) || ($userlevel == 0) || ($userlevel == 1 && $uinfo.level != 0)}<tr>
      <th colspan="2" class="bighead"><input type="button" class="button" value="Edit Scout Record" onclick="window.location='admin.php?page=records&amp;id={$uinfo.id}&amp;action=edit'" /></th>
    </tr>{/if}
		<tr>
		  <th colspan="2" class="bighead"><input type="submit" name="Submit" value="{$action}" class="button" />
      <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button" />
</th>
		</tr>
	  </table>
</form>
{elseif $action == "view"}
<h1>Viewing {$uinfo.uname}</h1>
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
  <tr>
    <th colspan="2" class="bighead">Website Access</th>
  </tr>
  <tr>
    <td width="50%" align="right">Username: </td>
    <td>{$uinfo.uname}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Administration Panel Access Level: </td>
    <td>	{if $uinfo.level == 0}Administrator Access Level
			{elseif $uinfo.level == 1}Scouter Access Level
			{elseif $uinfo.level == 2}Troop Leader Access Level
			{elseif $uinfo.level == 3}Group Leader Access Level
			{elseif $uinfo.level == 4}Second Access Level
            {elseif $uinfo.level == 5}No Administration Panel Access{/if}
	</td>
  </tr>
    <tr>
    <td width="50%" align="right">Group: </td>
    <td>{$uinfo.team}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Status: </td>
    <td>{if $uinfo.status == 1}Active{else}Inactive{/if}</td>
  </tr>
  <tr>
    <th colspan="2" class="bighead">Personal Information</th>
  </tr>
  <tr>
    <td width="50%" align="right">First Name: </td>
    <td>{$details.firstname}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Surname: </td>
    <td>{$details.lastname}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Date Of Birth: </td>
    <td>{$details.dob}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Telephone: </td>
    <td>{$details.tel}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Cellphone: </td>
    <td>{$details.cell}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Address: </td>
    <td>{$details.address}</td>
  </tr>
  <tr>
    <td width="50%" align="right">Email Address: </td>
    <td>{$details.email}</td>
  </tr>
  <tr>
    <th colspan="2" class="bighead">{if ($uinfo.level > $userlevel && $userlevel <= 3) || ($userlevel == 0) || ($userlevel == 1 && $uinfo.level != 0)}<input type="button" class="button" value="Edit Scout Record" onclick="window.location='admin.php?page=records&amp;id={$uinfo.id}&amp;action=edit&amp;back=view'" />{/if}</th>
  </tr>
</table>
<p align="center"><input type="button" class="button" value="Back" onclick="window.location='admin.php?page=users'" /></p>
{elseif $action == "email" || $action == "emailall"}
<form name="form1" action="{$editFormAction}" method="post">
<h1>Email {$username}</h1>
    <table width="100%" border="0" cellpadding="2" cellspacing="0">
    <tr>
      <td width="41%"><div align="right">Subject of email</div></td>
      <td width="59%">
        <div align="left">
          <input name="subject" type="text" size="60" class="inputbox">
        </div></td>
    </tr>
  <tr>
    <td colspan="2"><div align="center">Email Message:<br /><textarea name="email" cols="100" rows="20" class="inputbox"></textarea></div></td>
  </tr>
  <tr>
		  <th colspan="2" class="bighead"><input type="submit" name="submit" value="Send Email" class="button">
      <input name="Cancel" type="button" id="Cancel" value="Cancel" onclick="history.go(-1);" class="button">
</th>
  </tr>
</table>
</form>
{/if}
<div align="center">
 <a href="http://www.cmscout.za.net/index.php?page=subsite&amp;site=Manual&amp;content=adminpanel-users" target="_blank">Help</a>
</div>